export default {
  name: 'delMenuMixin',
  computed: {
    visitedViews() {
      return this.$store.state.tagsView.visitedViews
    },
    currentPath() {
      return this.$route.path
    },
    currentView() {
      return this.visitedViews?.find(item => item.path === this.currentPath)
    }
  },
  mounted() {
    
  },
  methods: {
    // toLastView(visitedViews, view) {
    //   const latestView = visitedViews.slice(-1)[0]
    //   if (latestView) {
    //     // this.$router.push(latestView.fullPath)
    //   } else {
    //     // now the default is to redirect to the home page if there is no tags-view,
    //     // you can adjust it according to your needs.
    //     if (view.name === 'Dashboard') {
    //       // to reload home page
    //       this.$router.replace({ path: '/redirect' + view.fullPath })
    //     } else {
    //       this.$router.push('/')
    //     }
    //   }
    // },
    // 关闭当前窗口
    closeCurrentTag() {
      this.$store.dispatch('tagsView/delView', this.currentView).then(({ visitedViews }) => {
        // this.toLastView(visitedViews, this.currentView)
      })
    },
  }
  
}